/*----------------------------------------------------------------------------------------------
* This source file is part of Kinect-Fighter (A Fighting Game controlled 
*	by Kinect and Keyboard.)
*
* Copyright (c) 2012-2012 Hu Guozhu
*
* Usage of this program is free for non-commercial use and licensed under the
* the terms of the MIT License.
*
*-------------------------------------------------------------------------------------------------*/
#include "stdafx.h"

#include "KFGameState.h"
#include "KFClientApp.h"

namespace KinectFighter
{
	KFGameState::KFGameState()
	{
		static bool bInitLoadRes = false;
		if ( !bInitLoadRes )
		{
			loadResource("data/GameState","FileSystem","RS_GameState");	
			bInitLoadRes = true;
		}
	}

	KFGameState::~KFGameState()
	{
		if ( Ogre::ResourceGroupManager::getSingleton().resourceGroupExists("RS_GameState") )
			unloadResource("RS_GameState");
	}

	void KFGameState::changeState(KFGameState *state )
	{ 
		KFClientApp::GetSingletonPtr()->changeState(state); 
	}

	void KFGameState::pushState( KFGameState *state) 
	{ 
		KFClientApp::GetSingletonPtr()->pushState(state); 
	}

	void KFGameState::popState() 
	{ 
		KFClientApp::GetSingletonPtr()->popState(); 
	}

	void KFGameState::requestShutdown() 
	{
		KFClientApp::GetSingletonPtr()->requestShutdown();
	}

	void KFGameState::loadResource(std::string Path,std::string Type,std::string GroupName,bool recursive)
	{
		Ogre::ResourceGroupManager::getSingleton().addResourceLocation(Path,Type,GroupName,recursive);
		Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup(GroupName);
	}
	void KFGameState::unloadResource(std::string GroupName)
	{	
		Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(GroupName);
	}
	void KFGameState::updateAfterRender( float lTimeElapsed)
	{

	}


}
